<?php 
/**
 * 物品相关
 *
 */

class GoodsModel {

	static public function GetTableName()
	{
		return  'goods';
	}

	static public function Db() {
		return ApiDB::Instance($GLOBALS['CONFIG_DATABASE']);
	}

	static public function Add($uid, $description)
	{
		$table = self::GetTableName();
		$DB = self::Db();
                $condition = array(
                    'uid' => $uid,
                    'description' => $description
                );
		$result = $DB->Insert($table, $condition);

		return $result;
	}

	static public function remove($gid)
	{
		$table = self::GetTableName();
		$DB = self::Db();
                $condition = array(
                    'gid' => $gid,
                );
		$result = $DB->Delete($table, $condition);

		return $result;
	}

	static public function byuser($uid)
	{
		$table = self::GetTableName();
		$DB = self::Db();
                $condition = array(
                    'uid' => $uid,
                );
		$result = $DB->LimitQuery($table, $condition);

		return $result;
	}

}